<ui:fragment
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:nxr="http://nuxeo.org/nxweb/resources">

  <nxr:bundle name="dnd_common" target_js="#{pageJsTarget}" />

  <h:outputScript target="#{pageJsTarget}">
    var baseURL='#{baseURL}';
    function getBaseURL() {
      return baseURL;
    }

    var ctx = {
      currentDocument : '#{currentDocument.id}',
      <c:if test="#{currentDomain!=null}">
       currentDomain : '#{currentDomain.id}',
      </c:if>
      <c:if test="#{currentWorkspace!=null}">
        currentWorkspace : '#{currentWorkspace.id}',
      </c:if>
      conversationId : '#{nxu:javaScriptEscape(org.jboss.seam.core.manager.currentConversationId)}',
      lang : '#{localeSelector.localeString}',
      repository : '#{currentDocument.repositoryName}'
    };

    function initNXDrapAndDropOnPage(scope) {
      // initernal DnD
      jQuery(".nxDraggable",scope).nxInitDraggables();
      jQuery(".nxDropTarget",scope).nxInitDropTargets();
    }

    jQuery(document).ready(function(){
      // init Dropout and Internal DnD
      initNXDrapAndDropOnPage(null);
    });
  </h:outputScript>

</ui:fragment>
